<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    // set = 1 ,2,3,4   subset = 2,3
    function isSuperset(set, subset) {
        for (var elem of subset) {
            if (!set.has(elem)) {
                return false;
            }
        }
        return true;
    }

    function union(setA, setB) {
        var _union = new Set(setA);
        for (var elem of setB) {
            _union.add(elem);
        }
        return _union;
    }

    function intersection(setA, setB) {
        var _intersection = new Set();
        for (var elem of setB) {
            if (setA.has(elem)) {
                _intersection.add(elem);
            }
        }
        return _intersection;
    }

    function difference(setA, setB) {
        var _difference = new Set(setA);
        for (var elem of setB) {
            _difference.delete(elem);
        }
        return _difference;
    }

    //Examples
    var setA = new Set([1, 2, 3, 4]),
        setB = new Set([2, 3]),
        setC = new Set([3, 4, 5, 6]);

    console.log(isSuperset(setA, setB));// => true
    console.log(union(setA, setC)); // => Set [1, 2, 3, 4, 5, 6]
    console.log(intersection(setA, setC)); // => Set [3, 4]
    console.log(difference(setA, setC)); // => Set [1, 2]

</script>
</body>
</html>